/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package reporting;

import java.util.*;
import java.text.*;

/**
 *
 * @author Rick
 */
public class DateHandler {

    public static void main(String[] args) {
        try {
            String str_date1 = "3/16/10";
            String str_date2 = "4/18/11";
            DateFormat formatter;
            Date date1,date2;
            formatter = new SimpleDateFormat("MM/dd/yy");
            date1 = formatter.parse(str_date1);
            date2 = formatter.parse(str_date2);
            /*
             * 0 if 2 dates are equal
             *  < 0 if date is after
             *  > 0 if date is before
             */
            System.out.println("Date comparison = " + date1.compareTo(date2));
            System.out.println("Date comparison = " + date2.compareTo(date1));
            System.out.println("Today is " + date1);
        } catch (ParseException e) {
            System.out.println("Exception :" + e);
        }
    }

}
